/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package core.api;

import core.definition.GlobalConstant;

/**
 *
 * @author ASUS_2
 */
public class APIResult {

    private Integer code;
    private String desc;
    private String data;

    public APIResult(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * @return the code
     */
    public int getCode() {
        return code;
    }

    /**
     * @param code the code to set
     */
    public void setCode(int code) {
        this.code = code;
    }

    /**
     * @return the desc
     */
    public String getDesc() {
        return desc;
    }

    /**
     * @param desc the desc to set
     */
    public void setDesc(String desc) {
        this.desc = desc;
    }
//    public <T> T fromJson(String json, Class<T> classOfT) throws JsonSyntaxException {
//    Object object = fromJson(json, (Type) classOfT);
//    return Primitives.wrap(classOfT).cast(object);
//  }

    public <T extends Object> T getData(Class<T> classOfT) {
        return GlobalConstant.GSON.fromJson(data, classOfT);
    }
}
